Probability density function |
|
Cumulative distribution function |
|
Parameters | |
---|---|
Support | |
CDF | |
Mean | |
Median | No simple closed form |
Mode | |
Variance | |
Skewness | |
Ex. kurtosis | |
Entropy | |
MGF | |
CF |
In probability theory and statistics, the gamma distribution is a two-parameter family of continuous probability distributions. It has a scale parameter θ and a shape parameter k. If k is an integer, then the distribution represents an Erlang distribution; i.e., the sum of k independent exponentially distributed random variables, each of which has a mean of θ (which is equivalent to a rate parameter of θ−1) .
The gamma distribution is frequently a probability model for waiting times; for instance, in life testing, the waiting time until death is a random variable that is frequently modeled with a gamma distribution.[1] It is the maximum entropy probability distribution for a random variate X for which is fixed and greater than zero, and is fixed ( is the digamma function).[2]
Contents |
A random variable X that is gamma-distributed with scale θ and shape k is denoted
The probability density function of the gamma distribution can be expressed in terms of the gamma function parameterized in terms of a shape parameter k and scale parameter θ. Both k and θ will be positive values.
The equation defining the probability density function of a gamma-distributed random variable x is
(This parameterization is used in the infobox and the plots.)
Alternatively, the gamma distribution can be parameterized in terms of a shape parameter α = k and an inverse scale parameter β = 1⁄θ, called a rate parameter:
If α is a positive integer, then
Both parametrizations are common because either can be more convenient depending on the situation.
The cumulative distribution function is the regularized gamma function:
where is the lower incomplete gamma function.
It can also be expressed as follows, if k is a positive integer (i.e., the distribution is an Erlang distribution):[3]
Unlike the mode and the mean which have readily calculable formulas based on the parameters, the median does not have an easy closed form equation. The median for this distribution is defined as the constant x0 such that
The ease of this calculation is dependent on the alpha parameter. This is best achieved by a computer since the calculations can quickly grow out of control.
If Xi has a Γ(ki, θ) distribution for i = 1, 2, ..., N (i.e., all distributions have the same scale parameter θ), then
provided all Xi' are independent.
The gamma distribution exhibits infinite divisibility.
If
then for any α > 0,
The Gamma distribution is a two-parameter exponential family with natural parameters k − 1 and −1⁄θ, and natural statistics X and ln(X).
The information entropy is given by
where ψ(k) is the digamma function.
One can also show that (if we use the shape parameter k and the inverse scale parameter β),
Or alternatively, using the scale parameter θ,
The directed Kullback–Leibler divergence between ('true' distribution) and ('approximating' distribution) is given by[4]
The Laplace transform of the gamma PDF is
The likelihood function for N iid observations (x1, ..., xN) is
from which we calculate the log-likelihood function
Finding the maximum with respect to θ by taking the derivative and setting it equal to zero yields the maximum likelihood estimator of the θ parameter:
Substituting this into the log-likelihood function gives
Finding the maximum with respect to k by taking the derivative and setting it equal to zero yields
where
is the digamma function.
There is no closed-form solution for k. The function is numerically very well behaved, so if a numerical solution is desired, it can be found using, for example, Newton's method. An initial value of k can be found either using the method of moments, or using the approximation
If we let
then k is approximately
which is within 1.5% of the correct value. An explicit form for the Newton-Raphson update of this initial guess is given by Choi and Wette (1969) as the following expression:
where denotes the trigamma function (the derivative of the digamma function).
The digamma and trigamma functions can be difficult to calculate with high precision. However, approximations known to be good to several significant figures can be computed using the following approximation formulae:
and
For details, see Choi and Wette (1969).
With known k and unknown , the posterior PDF for theta (using the standard scale-invariant prior for ) is
Denoting
Integration over θ can be carried out using a change of variables, revealing that 1⁄θ is gamma-distributed with parameters .
The moments can be computed by taking the ratio (m by m = 0)
which shows that the mean ± standard deviation estimate of the posterior distribution for theta is
Given the scaling property above, it is enough to generate gamma variables with as we can later convert to any value of with simple division.
Using the fact that a distribution is the same as an distribution, and noting the method of generating exponential variables, we conclude that if is uniformly distributed on , then − is distributed Now, using the "α-addition" property of gamma distribution, we expand this result:
where are all uniformly distributed on and independent.
All that is left now is to generate a variable distributed as for and apply the "α-addition" property once more. This is the most difficult part.
We provide an algorithm without proof. It is an instance of the acceptance-rejection method:
To summarize,
where
In Bayesian inference, the gamma distribution is the conjugate prior to many likelihood distributions: the Poisson, exponential, normal (with known mean), Pareto, gamma with known shape σ, inverse gamma with known shape parameter, and Gompertz with known scale parameter.
The Gamma distribution's conjugate prior is:[5]
Where Z is the normalizing constant, which has no closed form solution. The posterior distribution can be found by updating the parameters as follows.
Where is the number of observations, and is the observation.
If the shape parameter of the gamma distribution is known, but the inverse-scale parameter is unknown, then a gamma distribution for the inverse-scale forms a conjugate prior. The compound distribution, which results from integrating out the inverse-scale has a closed form solution, known as the compound gamma distribution.[6]
The gamma distribution has been used to model the size of insurance claims and rainfalls.[7] This means that aggregate insurance claims and the amount of rainfall accumulated in a reservoir are modelled by a gamma process. The gamma distribution is also used to model errors in multi-level Poisson regression models, because the combination of the Poisson distribution and a gamma distribution is a negative binomial distribution.
In neuroscience, the gamma distribution is often used to describe the distribution of inter-spike intervals.[8] Although the gamma distribution often provides phenomenologically a good fit, there is no underlying biophysical motivation of it.
In bacterial gene expression, the copy number of a constitutively expressed protein often follows the gamma distribution, where the scale and shape parameter are, respectively, the mean number of bursts per cell cycle and the mean number of protein molecules produced by a single mRNA during its lifetime.[9]
The gamma distribution is widely used as a conjugate prior in Bayesian statistics. It is the conjugate prior for the precision (i.e. inverse of the variance) of a normal distribution. It is also the conjugate prior for the exponential distribution.
|